/**
 * Created by claim on 17-3-19.
 */
//A simple router for web server

const router = require('koa-router')();
const renderer = require('./view');
router.get('/hello/:id', async(ctx, next) => {
    ctx.body = `Hello, user ${ctx.params.id}`;
    await next();
});

router.get('/ect/:id', async(ctx, next) => {
    ctx.body = await renderer('hello.ect', {username: ctx.params.id});
    await next();
});

router.use((ctx) => {
    console.log(ctx.method + ' request accept');
});

module.exports = router;